package wechat

import (
	ltool "gitee.com/wosylf/ltool"
	"gitee.com/wosylf/ltool/pkg/util"
	"gitee.com/wosylf/ltool/pkg/xhttp"
)

func (a *C微信链接) F文本检测是否合规(bm ltool.BodyMap) (bs []byte, err error) {
	accessToken, err := util.F获取缓存token(a)
	if err != nil {
		return
	}
	//bm.Set("content",content).Set("version",2).Set("scene",2)
	url := "https://api.weixin.qq.com/wxa/msg_sec_check?access_token=" + accessToken
	_, bs, err = xhttp.NewClient().Type(xhttp.TypeForm).Post(url).SendString(bm.EncodeURLParams()).EndBytes(ctx)
	if err != nil {
		return nil, err
	}
	return bs, nil
}

func (a *C微信链接) F解析手机号(bm ltool.BodyMap) (bs []byte, err error) {
	accessToken, err := util.F获取缓存token(a)
	if err != nil {
		return
	}
	//bm.Set("content",content).Set("version",2).Set("scene",2)
	url := "https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=" + accessToken
	_, bs, err = xhttp.NewClient().Type(xhttp.TypeForm).Post(url).SendString(bm.EncodeURLParams()).EndBytes(ctx)
	if err != nil {
		return nil, err
	}
	return bs, nil
}
